//-----------------------------------------------------------------------
// <copyright file="ModifyFeedbackPresenter.cs" company="Simnova LLC">
//     Copyright (c) Simnova LLC. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace Simnova.Collaborate.Presenter
{
    using System;
    using System.Collections.Generic;
    using System.Text;

    public class ModifyFeedbackPresenter
    {
        private readonly View.IModifyFeedback modifyFeedbackView;
        private int userId;
        private int feedbackId;
        private int productId;

        public ModifyFeedbackPresenter(View.IModifyFeedback modifyFeedbackView, int userId, int productId)
        {
            this.userId = userId;
            this.feedbackId = 0;
            this.productId = productId;
            this.modifyFeedbackView = modifyFeedbackView;
        }

        public void Save()
        {
            AppServer.Feedback feedback = new AppServer.Feedback();
            feedback.FeedbackId = this.feedbackId;
            feedback.UserId = this.userId;
            feedback.ProductId = this.productId;
            feedback.Title = this.modifyFeedbackView.Title;
            feedback.Description = this.modifyFeedbackView.Description;

            AppServer.CollaborateServiceClient collaborateClient = new AppServer.CollaborateServiceClient();
            collaborateClient.SaveFeedback(feedback);
            collaborateClient.Close();
        }
    }
}
